﻿// <copyright file="Wake.cs" company="Hallvard Korsgaard">
//  Microsoft Public License (Ms-PL). See license details here: http://enoceannet.codeplex.com/license
// </copyright>
// <author>Hallvard Korsgaard</author>

namespace EnOcean.Command
{
  using System;

  /// <summary>
  /// If the TCM receives the WAKE command, it wakes up from sleep mode. In contrast to all other telegrams this telegram is only one byte long.
  /// </summary>
  [Serializable]
  public class Wake : CommandTelegram
  {
    /// <summary>
    /// Creates the byte format of the message.
    /// </summary>
    /// <param name="message">A byte array of length 1 to hold the message contents.</param>
    protected internal override void CreateMessage(byte[] message)
    {
      if (message == null)
      {
        throw new ArgumentNullException("message");
      }

      if (message.Length < 1)
      {
        throw new ArgumentOutOfRangeException("message", "array length must be at least 1 to hold the message content.");
      }

      message[0] = (byte)CommandType.Wake;
    }
  }
}
